<html>
<head><meta charset="utf-8"><title>local_inner_macros ? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros.20.3F.html">local_inner_macros ?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="192123611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros%20%3F/near/192123611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros.20.3F.html#192123611">(Mar 28 2020 at 13:42)</a>:</h4>
<p>In <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3712" title="https://github.com/rust-analyzer/rust-analyzer/issues/3712">rust-analyzer#3712</a>, there is a bug related to lack of implementation of <code>local_inner_macros</code>. I want to try to implement it , but its name resolution is so strange that I don't know how we could handle it properly : </p>
<blockquote>
<p>The local_inner_macros modifier resolves all macro invocations made from within that macro as macros in the same crate. So if info! expands to an invocation of log! then this would be resolved as $crate::log! rather than requiring the caller to have log in scope.  </p>
</blockquote>
<p>(Copy from <a href="https://github.com/rust-lang/log/pull/288" title="https://github.com/rust-lang/log/pull/288">https://github.com/rust-lang/log/pull/288</a>)</p>
<p><span class="user-mention" data-user-id="133169">@matklad</span>  Any idea ?</p>



<a name="192184703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros%20%3F/near/192184703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros.20.3F.html#192184703">(Mar 29 2020 at 17:21)</a>:</h4>
<p>I would say that we should store the precense of <code>#[local_inner_macros]</code> on the <code>Hygiene</code> struct, and use that during name resolution</p>



<a name="192185453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros%20%3F/near/192185453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros.20.3F.html#192185453">(Mar 29 2020 at 17:40)</a>:</h4>
<p>I am a little bit lost here. does <code>Hygiene</code> struct belong to call-site, not def-site ?</p>



<a name="192187192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros%20%3F/near/192187192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/local_inner_macros.20.3F.html#192187192">(Mar 29 2020 at 18:21)</a>:</h4>
<p>Hygiene kinda both; At the moment it stores the <code>def_crate</code>, which is exactly what is needed for local inner macros</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>